package com.meiya.baseweb.action;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.opensymphony.xwork2.ActionProxy;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:dataSourceContext.xml")
public class PubopionActionTestc extends StrutsConventionSpringJUnit4TestCase {
	@Test
	public void testDefaultTitle() throws Exception {
 
		// Add some URL parameters
		request.setParameter("id", "78");
 
		// Execute action
		ActionProxy proxy = getActionProxy("/pubopion!deletePubopion.action");
		String result = proxy.execute();
 
		// Validate results
		Assert.assertEquals("success", result);
		// Assert features
		PubopionAction action = (PubopionAction) proxy.getAction();
		Assert.assertNotNull(action.getId());
		Assert.assertEquals(999, action.getId());
		

		Assert.assertNotNull(action.getPub());
		Assert.assertEquals("观点", action.getPub().getTitle());
		

		Assert.assertNotNull(action.getPub().getDomain());
		Assert.assertEquals("78main", action.getPub().getDomain());
	}
}
